program q1009;
var
    i, k, n, m, ti: integer;
    j, f: array[1..1000] of integer;
    rate: array[1..1000] of real;
    ans, t: real;
begin
    assign(input, '');
    assign(output, '');
    reset(input);
    rewrite(output);

    while (not eof) do
    begin
        readln(m, n);
        if (m = -1) and (n = -1) then break;
        
        for i:=1 to n do
        begin
            readln(j[i], f[i]);
            rate[i] := j[i] / f[i];
        end;

        for i:=1 to n-1 do
            for k:=i+1 to n do
            begin
                if (rate[i] < rate[k]) then
                begin
                    t := rate[i]; rate[i] := rate[k]; rate[k] := t;
                    ti := j[i]; j[i] := j[k]; j[k] := ti;
                    ti := f[i]; f[i] := f[k]; f[k] := ti;
                end;
            end;
            
        ans := 0;
        for i:=1 to n do
        begin
            if (m >= f[i]) then
            begin
                ans := ans + j[i];
                m := m - f[i];
            end
            else
            begin
                ans := ans + m * rate[i];
                break;
            end;
        end;

        writeln(ans:0:3);
    end;

    close(input);
    close(output);
end.
